package com.client.controller;

import com.google.gwt.user.client.ui.TextBox;
/**
 * Extension des {@link EntryController} au {@link TextBox}
 * @author queyroi
 *
 */
public abstract class TextBoxController implements EntryController{
	
	/**
	 * {@link TextBox} controllée
	 */
	protected TextBox textBox;
	/**
	 * Nom de la {@link TextBox} 
	 */
	protected String source;
	
	
	public TextBoxController(TextBox textBox,String source) {
		this.textBox = textBox;
		this.source = source;
	}
	
	
	public abstract boolean check();
	
	
	public String getSource(){
		return source;
	}
	
	public void setSource(String source) {
		this.source = source;
	}

	
	/**
	 * @param textBox the textBox to set
	 */
	public void setTextBox(TextBox textBox) {
		this.textBox = textBox;
	}
	/**
	 * @return the textBox
	 */
	public TextBox getTextBox() {
		return textBox;
	}
	
	public void setStyleError(){
		textBox.addStyleName("textBoxError");
	}
	
	public void removeStyleError(){
		textBox.removeStyleName("textBoxError");
	}
	
}
